home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13740 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.2 KB  |  49 lines

  1. Path: news.asu.edu!ryan1m
  2. From: ryan1m@imap2.asu.edu
  3. Newsgroups: comp.lang.c++
  4. Subject: HELP: Code in Header Files
  5. Date: 27 Mar 1996 05:43:18 GMT
  6. Organization: Arizona State University
  7. Message-ID: <4jakhm$g3d@news.asu.edu>
  8. NNTP-Posting-Host: general2.asu.edu
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11.  
  12. I have a problem understanding how header files work.  If it matters I am 
  13. using Borland C++ 4.5...
  14.  
  15. The problem is I defined a header file   string.h  in this I declared a 
  16. string class.  If I put the actual code to the functions in this class 
  17. into the header file, the compiler does not like it.  I looked at other 
  18. .h files and saw they did not do it this way.
  19.  
  20. So then I tried writing the actual code into string.cpp and compiling 
  21. that with and #include "string.h".
  22.  
  23. It worked but my code for my program does not recognize the functions.  
  24. It says I did not code them yet.
  25.  
  26. It finds the headers just fine but not the actual code.
  27.  
  28. ie:
  29.  
  30. #include "string.h"
  31.  
  32. void main(void)
  33. {
  34.     String blah("hello world");
  35. }
  36.  
  37. the error will say something like
  38.  
  39. Undefined Symbol String::~String() in module STEST.CPP
  40.  
  41. and it goes on to list the rest of the function not "defined".
  42.  
  43. Please help...
  44.  
  45. Thanks,
  46.  
  47. Mike Ryan   ryan1m@asu.edu
  48.  
  49.